package structural.flyWeight;
import java.util.HashMap;
import java.util.Map;

public class EmployeeFactory {
    //工厂模式
    private static final Map<String,Employee> EMPLOYEE_MAP = new HashMap<String, Employee>();
    public static Employee getManager(String department){
        Manager manager = (Manager)EMPLOYEE_MAP.get(department);
        //同种类型 的 “报告” 只创建一次。
        if(manager == null){
            manager = new Manager(department);
            System.out.println("创建部门经理："+department);
            String report = department+"部门汇报，报告内容：。。。。。。。。。";
            manager.setReportContent(report);
            System.out.println(report);
            EMPLOYEE_MAP.put(department,manager);
        }
        return manager;
    }
}